package com.naiterui.ehp.bs.emr.service;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.emr.vo.health.HealthRecordVO;

import java.util.List;

/**
 * @Description 健康档案
 * @Author gongbaoqiang
 * @Date 2020/6/3 2:22 PM
 */
public interface IPatientHealthRecordService {

    /**
     * 保存草稿
     * <pre>
     *     1. Redis缓存，
     *     2. 提交时进行清除
     *     3. 医生无法看到草稿数据
     * </pre>
     * @throws BusinessException
     */
    void cacheRecord(Long familyId, HealthRecordVO recordVO) throws BusinessException;

    /**
     * 提交健康档案
     * <pre>
     *     1. 提交后医生可见
     *     2. 删除对应的缓存数据
     * </pre>
     * @param familyId
     * @param recordVO
     * @throws BusinessException
     */
    void submit(Long familyId, HealthRecordVO recordVO) throws BusinessException;

    /**
     * 健康档案详情
     * <pre>
     *     1. 先查看是否有缓存（草稿），没有则
     *     2. 查询数据库中档案
     * </pre>
     * @param familyId
     * @return
     * @throws BusinessException
     */
    HealthRecordVO detail(Long familyId) throws BusinessException;

    /**
     * 获取患者已经提交档案的家庭成员
     * @return
     * @throws BusinessException
     */
    List<Long> findFamilyIdsByPatient(Long patientId) throws BusinessException;
}
